<?php

namespace Gwit\PlateformBundle\Form;

//use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
//use Symfony\Component\Form\FormBuilderInterface;
use FOS\UserBundle\Form\Type\RegistrationFormType as BaseType;

/**
 * Constructeur de formulaire utilisateur
 * 
 */

class UserType extends BaseType
{
    public function buildForm(FormBuilder $builder, array $options)
    {
        parent::buildForm($builder, $options);
        //Afin de garder le style de la page source, une class a été ajouté manuellement
        $builder
                ->add('username', 'text', array('required' => false, 'attr' => array('class' => 'control-label')))
                ->add('plainPassword', 'repeated', array('required' => false,'type' => 'password', 'attr' => array('class' => 'control-label')))
                ->add('first_name', 'text', array('required' => false, 'attr' => array('class' => 'control-label')))
                ->add('last_name', 'text', array('required' => false, 'attr' => array('class' => 'control-label')))
                ->add('family_name', 'text', array('required' => false, 'attr' => array('class' => 'control-label')))
                ->add('nationality', 'text', array('required' => false, 'attr' => array('class' => 'control-label')))
                ->add('email', 'text', array('required' => false, 'attr' => array('class' => 'control-label')))
                ->add('security_question', 'text', array('required' => false, 'attr' => array('class' => 'control-label')))
                ->add('security_answer', 'text', array('required' => false, 'attr' => array('class' => 'control-label')))
        ;
    }
    
    public function getName()
    {
        return "gwit_user_registration_form";
    }
    
    public function getDefaultOptions(array $option)
    {
        return array(
            'data_class' => 'Gwit\PlateformBundle\Entity\User',
            'intention'  => 'registration',
        );
    }
}